package bz.yfw.example.s3blazeds.part2.helper
{
	import bz.yfw.example.s3blazeds.part2.model.view.EmpViewModel;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditSecondView;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditThirdView;
	
	import org.seasar.akabana.yui.framework.ns.viewpart;
	
	import spark.components.TextArea;
	import spark.components.TextInput;
	import spark.components.supportClasses.ViewReturnObject;
	
	use namespace viewpart;

	/**
	 * 社員編集2から3へのHelper
	 * @author tokufxug http://twitter.com/tokufxug
	 */ 
	public class EmpEditSecondNextHelper
	{
		public var view:EmpEditSecondView;
		
		viewpart var txtarAddress:TextArea;
		
		viewpart var txtinptTelL:TextInput;
		
		viewpart var txtinptTelC:TextInput;
		
		viewpart var txtinptTelR:TextInput;
		
		viewpart var txtinptEmailL:TextInput;
		
		viewpart var txtinptEmailR:TextInput;
		
		public function get empViewModel():EmpViewModel {
			if (view.viewModel) {
				return view.viewModel;
			}
			return new EmpViewModel();
		}
		
		public function moveNext():void {
			var vm:EmpViewModel = empViewModel;
			
			vm.address = txtarAddress.text;
			vm.telL = txtinptTelL.text;
			vm.telC = txtinptTelC.text;
			vm.telR = txtinptTelR.text;
			vm.emailL = txtinptEmailL.text;
			vm.emailR = txtinptEmailR.text;
			view.navigator.pushView(EmpEditThirdView, vm);
		}
	}
}